﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@include file="link/heat.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>汽车出租系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/zTree/css/zTreeStyle/zTreeStyle.css"
          type="text/css">
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/easyui/themes/default/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/wu.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/icon.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/zTree/js/jquery.ztree.core.js"></script>
    <style>
        .wu-header {
            background: url("${pageContext.request.contextPath}/static/imgs/bg_header.jpg") bottom repeat-x;
        }
    </style>
</head>
<body class="easyui-layout">
<!-- begin of header -->
<div class="wu-header" data-options="region:'north',border:false,split:true">
    <div class="wu-header-left">
        <h1>汽车出租系统</h1>
    </div>
    <div class="wu-header-right">
        <p style="color: palevioletred"><strong class="easyui-tooltip" title="2条未读消息">
            ${sessionScope.loginUser.userName}</strong>，欢迎您！</p>
        <p><a href="#">网站首页</a>|
            <a href="#">支持论坛</a>|
            <a href="#">帮助中心</a>|
            <a href="<c:url value="/user/logout.action"/>">安全退出</a></p>
    </div>
</div>
<!-- end of header -->
<!-- begin of sidebar -->
<div class="wu-sidebar" data-options="region:'west',split:true,border:true,title:'导航菜单'">
    <div class="ztree" id="treeMenus" data-options="border:false,fit:true"></div>
</div>
<!-- end of sidebar -->
<!-- begin of main -->
<div class="wu-main" data-options="region:'center',split:true,border:true">
    <div id="wu-tabs" class="easyui-tabs" data-options="border:false,fit:true">
        <div title="首页" data-options="href:'template/main.jsp',closable:false,iconCls:'icon-tip',cls:'pd3'"></div>
    </div>
</div>
<!-- end of main -->
<!-- begin of footer -->
<div class="wu-footer" data-options="region:'south',border:true,split:true">
    &copy; 2020 老闫 All Rights Reserved
</div>

<SCRIPT type="text/javascript">

    function zTreeOnClick(event, treeId, treeNode) {
        if (treeNode.isParent != undefined && treeNode.isParent != true) {
            addTab(treeNode.name, treeNode.href, treeNode.tabIcon, true);
        }
    };
    var setting = {
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: zTreeOnClick
        }
    };
    var zNodes = [
        {
            id: 1,
            pId: 0,
            name: "汽车租赁系统",
            open: true,
            isParent: true,
            href: '${pageContext.request.contextPath}/template/main.jsp',
            icon: '${pageContext.request.contextPath}/static/css/icons/user_add.png'
        },
        {
            id: 2,
            pId: 1,
            name: "客户管理",
            isParent: false,
            href: '${pageContext.request.contextPath}/customer/show.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/status_away.png',
            tabIcon: 'icon-add'
        },
        {
            id: 3,
            pId: 1,
            name: "车辆管理",
            isParent: false,
            href: '${pageContext.request.contextPath}/car/show.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/car.png',
            tabIcon: 'icon-add'
        },
        {id: 4, pId: 1, name: "业务管理", isParent: true},
        {id: 5, pId: 1, name: "系统管理", isParent: true},
        {
            id: 6,
            pId: 4,
            name: "汽车出租",
            isParent: false,
            href: '${pageContext.request.contextPath}/carout/show.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/car.png',
        },
        // {id: 7, pId: 4, name: "出租单管理", isParent: false},
        {
            id: 8,
            pId: 4,
            name: "汽车入库",
            isParent: false,
            href: '${pageContext.request.contextPath}/carin/show.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/car.png',
        },
        {
            id: 9, pId: 4, name: "检查单管理", isParent: false,
            href: '${pageContext.request.contextPath}/carCheck/show.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/car.png',
        },
        {
            id: 10,
            pId: 5,
            name: "用户管理",
            isParent: false,
            href: '${pageContext.request.contextPath}/user/show.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/users.png',
        },
        {
            id: 11, pId: 5, name: "角色管理", isParent: false,
            href: '${pageContext.request.contextPath}/role/show.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/user_orange.png',
        },
        {id: 12, pId: 1, name: "数据统计", isParent: true},
        {
            id: 13, pId: 12, name: "年销售额", isParent: false,
            href: '${pageContext.request.contextPath}/view/yearMarket.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/user_orange.png',
        },
        {
            id: 14, pId: 12, name: "年客户增长", isParent: false,
            href: '${pageContext.request.contextPath}/view/yearCustomerIncrement.action',
            icon: '${pageContext.request.contextPath}/static/css/icons/user_orange.png',
        }
    ];

    $(document).ready(function () {
        $.fn.zTree.init($("#treeMenus"), setting, zNodes);
    });

    /**
     * Name 选项卡初始化
     */
    $('#wu-tabs').tabs({
        tools: [{
            iconCls: 'icon-reload',
            border: false,
            handler: function () {
                $('#wu-datagrid').datagrid('reload');
            }
        }]
    });

    /**
     * Name 添加菜单选项
     * Param title 名称
     * Param href 链接
     * Param iconCls 图标样式
     * Param iframe 链接跳转方式（true为iframe，false为href）
     */
    function addTab(title, href, iconCls, iframe) {
        var tabPanel = $('#wu-tabs');
        if (!tabPanel.tabs('exists', title)) {
            var content = '<iframe scrolling="auto" frameborder="0"  src="' + href + '" style="width:100%;height:100%;"></iframe>';
            if (iframe) {
                tabPanel.tabs('add', {
                    title: title,
                    content: content,
                    iconCls: iconCls,
                    fit: true,
                    cls: 'pd3',
                    closable: true
                });
            } else {
                tabPanel.tabs('add', {
                    title: title,
                    href: href,
                    iconCls: iconCls,
                    fit: true,
                    cls: 'pd3',
                    closable: true
                });
            }
        } else {
            tabPanel.tabs('select', title);
        }
    }

    /**
     * Name 移除菜单选项
     */
    function removeTab() {
        var tabPanel = $('#wu-tabs');
        var tab = tabPanel.tabs('getSelected');
        if (tab) {
            var index = tabPanel.tabs('getTabIndex', tab);
            tabPanel.tabs('close', index);
        }
    }

    //<!---->
</SCRIPT>
</body>
</html>
